{template 'common/header'}
<style>
    .nav-width{border-bottom:0;}
    .nav-width li.active{width:33%;text-align:center;overflow:hidden;height:40px;}
    .nav-width .normal{background:#EEEEEE;width:33%;text-align:center;overflow:hidden;height:40px;}
    .guide em{font-style:normal; color:#d9534f;}
    .guide .list-group .list-group-item a{color:#07d;}
    .guide .list-group .list-group-item{padding-top:20px;}
    .guide .img{margin-bottom:15px; display:inline-block; border:1px solid #cccccc;padding:3px;}
    .guide .con{padding: 10px 30px;}
</style>
<ul class="nav nav-tabs nav-width">
    <li {if $_GPC['step']==1 || $_GPC['step']==''}class="active"{/if} class="normal"><a href="javascript:;">1. 库款划拨查询</a></li>
    <li {if $_GPC['step']==2}class="active"{/if} class="normal"><a href="javascript:;">2. 扫描文件&发起划拨</a></li>
    <li {if $_GPC['step']==3}class="active"{/if} class="normal"><a href="javascript:;">3. 确认</a></li>
</ul>
<div class="clearfix">
    {if $_GPC['step'] == 1 || $_GPC['step'] == ''}
    <form action="" method="post"  class="form-horizontal" role="form" enctype="multipart/form-data" id="form1">
        <input type="hidden" name="step" value="2">
        <div class="panel panel-default">
            <div class="panel-heading">
                库款划拨基础信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">机关代字</label>
                    <div class="col-sm-5">
                        <select name="cates" class="form-control">
                            {loop $files $d}
                            <option value="{$d['title']}">{$d['title']}</option>
                            {/loop}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">年份</label>
                    <div class="col-sm-5">
                        <input type="text" id="fileyear" class="form-control" placeholder="请输入年份" name="fileyear" value="{$row['fileyear']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">文号</label>
                    <div class="col-sm-5">
                        <input type="text" id="fileid" class="form-control" name="fileid" value="{$row['fileid']}"  placeholder="请输入文件号"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <input name="submit" type="submit" value="下一步" class="btn btn-primary col-lg-1" />
                <input type="hidden" name="token" value="{$_W['token']}" />
            </div>
        </div>
    </form>
    {elseif $_GPC['step']== 2}
    <form action="" method="post"  class="form-horizontal" role="form" enctype="multipart/form-data" id="form1">
        <input type="hidden" name="step" value="3">
        <input type="hidden" name="id" value="{$id}">
        <div class="panel panel-default">
            <div class="panel-heading">
                扫描库款划拨文件
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">机关代字</label>
                    <div class="col-sm-6">
                        <input type="text" name="agency" class="form-control" value="{$row['agency']}" readonly="readonly"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">年份</label>
                    <div class="col-sm-6">
                        <input type="text" name="fileyear" class="form-control" value="{$row['fileyear']}" readonly="readonly"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">文号</label>
                    <div class="col-sm-6">
                        <input type="text" name="fileid" class="form-control" value="{$row['fileid']}"  readonly="readonly"  />
                    </div>
                </div>
                {if $row['num']>0}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">文件首页</label>
                    <div class="col-sm-6" style="margin-top:.5em;">
                        <img src="{$_W['attachurl']}{$row['firstpage']}" class="img-responsive img-thumbnail" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">剩余金额</label>
                    <div class="col-sm-6">
                        <input type="text" name="remain" class="form-control" value="{$row['remain']}"  readonly="readonly"  />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">已拨金额</label>
                    <div class="col-sm-6">
                        <input type="text" name="money" class="form-control" value="{$row['money']}" readonly="readonly"  />
                    </div>
                </div>
                {if $details}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">划拨记录</label>
                    <div class="col-sm-6">

                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th style="width:70px;">划拨金额</th>
                                <th style="width:60px;">状态</th>
                                <th style="width:60px;">创建人</th>
                                <th style="width: 70px;">拨款日期</th>
                            </tr>
                            </thead>
                            <tbody>
                            {loop $details $r}
                            <tr>
                                <td>{$r['money']}</td>
                                <td>{$status[$r['status']]}</td>
                                <td>{$r['creator']}</td>
                                <td>{php echo date('Y-m-d', $r['grandedate'])}</td>
                            </tr>
                            {/loop}
                            </tbody>
                        </table>
                    </div>
                </div>
                {/if}
                {else}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">文件首页图片</label>
                    <div class="col-sm-6">
                        {php echo tpl_form_field_scan('firstpage', $row['firstpage'],$_SERVER['HTTP_HOST']);}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">划拨总金额</label>
                    <div class="col-sm-6">
                        <input type="text" name="totalmoney" class="form-control" value="{$row['totalmoney']}"  placeholder="请输入总金额"/>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">签名页图片</label>
                    <div class="col-sm-6">
                        {php echo tpl_form_field_scan('signpage', $item['signpage'],$_SERVER['HTTP_HOST']);}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">本次划拨金额</label>
                    <div class="col-sm-6">
                        <input type="hidden" name="sid" value="{$item['id']}">
                        <input type="text" name="money" class="form-control" value="{$item['money']}" placeholder="请输入本次划拨金额"  />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-10">
                <input name="submit" type="submit" value="下一步" class="btn btn-primary col-lg-1" />
                <input type="hidden" name="token" value="{$_W['token']}" />
            </div>
        </div>
    </form>
    {elseif $_GPC['step']== 3}
    <form action="" method="post"  class="form-horizontal" role="form" enctype="multipart/form-data" id="form1">
        <input type="hidden" name="id" value="{$id}">
        <input type="hidden" name="step" value="4">
        <div class="panel panel-default">
            <div class="panel-heading">
                确认
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">机关代字</label>
                    <div class="col-sm-9">
                        <input type="text" name="agency" class="form-control" value="{$row['agency']}" disabled="true"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">年份</label>
                    <div class="col-sm-9">
                        <input type="text" name="fileyear" class="form-control" value="{$row['fileyear']}" disabled="true"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">文号</label>
                    <div class="col-sm-9">
                        <input type="text" name="fileid" class="form-control" value="{$row['fileid']}" disabled="true"  />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">总金额</label>
                    <div class="col-sm-9">
                        <input type="text" name="totalmoney" class="form-control" value="{$row['totalmoney']}" disabled="true"/>
                    </div>
                </div>
                {if $row[num]>0}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">已拨金额</label>
                    <div class="col-sm-9">
                        <input type="text" name="money" class="form-control" value="{$row['money']}" readonly="readonly"  />
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">文件首页</label>
                    <div class="col-sm-9" style="margin-top:.5em;">
                        <img src="{$_W['attachurl']}{$row['firstpage']}" class="img-responsive img-thumbnail" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">划拨签名</label>
                    <div class="col-sm-9" style="margin-top:.5em;">
                        <img src="{$_W['attachurl']}{$item['signpage']}" class="img-responsive img-thumbnail" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">本次划拨金额</label>
                    <div class="col-sm-9">
                        <input type="text" name="money" class="form-control" value="{$item['money']}" disabled="true" />
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-12">
                <button type="submit" class="btn btn-danger" name="submit" value="audit"><i class="fa fa-eye"></i> 提交审核</button>&nbsp;
                &nbsp;&nbsp;
                <a  class="btn btn-primary"  href="{php echo url('finance/finance/list');}">返回列表</a>
                <input type="hidden" name="token" value="{$_W['token']}" />
            </div>
        </div>
    </form>
    {/if}
</div>
<script type="text/javascript">
    require(['jquery', 'util'], function($, u){
        $("#form1").submit(function(){
            {if $_GPC['step']== 1|| $_GPC['step'] == ''}
            if(!$("#fileyear").val()) {
                u.message('文件年份为必填项，请返回修改！！', '', 'error');
                return false;
            }
            if($("#fileid").val() == '') {
                u.message('文号为必填项，请返回修改！', '', 'error');
                return false;
            }
            {/if}
                {if $_GPC['step']== 2}
            if($("#totalmoney").val() == '') {
                u.message('总金额为必填项，请返回修改！', '', 'error');
                return false;
            }
            if($("#money").val() == '') {
                u.message('拨款金额必填项，请返回修改！', '', 'error');
                return false;
            }
               {/if}

            return true;
        });
    });

</script>
{template 'common/footer'}